*************************************************************
**Party Oragnization and Gender in European Elections 
**Party Politics 2020
**Andrea Aldrich 
*************************************************************


*************************************************************
** Table 1
*************************************************************

use aldrich.partypolitics.2020, clear

local simple ///
			changeinshare ///
			govt_binary ///
			eastern_europe ///
			PL_Quota ///
			CL_Quota ///
			closed_list  ///
			gallagher ///
			position ///
			lrgen ///
			ep_women ///
			pc100_pc_Women_in_Plead 
		
regress  female_lists  `simple', cluster(countrycode) 

regress  female_lists centralized_selection `simple', cluster(countrycode)

		
local IV ///
			changeinshare ///
			govt_binary ///
			eastern_europe ///
			PL_Quota ///
			CL_Quota ///
			closed_list  ///
			gallagher ///
			cen_changinshare ///
			cen_govt_binary ///
			cen_eastern_europe ///
			cen_PL_Quota ///
			cen_CL_Quota ///
			cen_closed  ///
			cen_gallagher ///
			position ///
			lrgen ///
			ep_women ///
			pc100_pc_Women_in_Plead 
		   
regress female_lists centralized_selection `IV', cluster(countrycode)
	

*************************************************************
** Figure 2 
*************************************************************			
			
	local IV ///
			changeinshare ///
			govt_binary ///
			eastern_europe ///
			PL_Quota ///
			CL_Quota ///
			closed_list  ///
			gallagher ///
			cen_changinshare ///
			cen_govt_binary ///
			cen_eastern_europe ///
			cen_PL_Quota ///
			cen_CL_Quota ///
			cen_closed  ///
			cen_gallagher ///
			position ///
			lrgen ///
			ep_women ///
			pc100_pc_Women_in_Plead 
		   
regress female_lists centralized_selection `IV', cluster(countrycode)


*vote share in decentralized parties
margins, at(changeinshare=(-25(5)25) centralized_selection=(0) cen_changinshare=(0)) saving(nointeraction, replace)

marginsplot, recast(line) recastci(rline) ciopts(lpattern(dash)) xtitle("Change in Vote Share in Decentralized Parties") ylabel(15(10)65) ///
	note("Predicted margins calculated at Centralized Selection=0 and Centralized Selection*Vote Share=0")
	graph save change_centralized_0, replace 


*vote share in centralized parties
margins, at(changeinshare=(-25) centralized_selection=(1) cen_changinshare=(-25)) saving(change_25neg , replace)
margins, at(changeinshare=(-20) centralized_selection=(1) cen_changinshare=(-20)) saving(change_20neg, replace)
margins, at(changeinshare=(-15) centralized_selection=(1) cen_changinshare=(-15)) saving(change_15neg, replace)
margins, at(changeinshare=(-10) centralized_selection=(1) cen_changinshare=(-10)) saving(change_10neg, replace)
margins, at(changeinshare=(-05) centralized_selection=(1) cen_changinshare=(-5)) saving(change_5neg, replace)
margins, at(changeinshare=(0) centralized_selection=(1) cen_changinshare=(0)) saving(change_zero, replace)
margins, at(changeinshare=(5) centralized_selection=(1) cen_changinshare=(5)) saving(change_5, replace)
margins, at(changeinshare=(10) centralized_selection=(1) cen_changinshare=(10)) saving(change_10, replace)
margins, at(changeinshare=(15) centralized_selection=(1) cen_changinshare=(15)) saving(change_15, replace)
margins, at(changeinshare=(20) centralized_selection=(1) cen_changinshare=(20)) saving(change_20, replace)
margins, at(changeinshare=(25) centralized_selection=(1) cen_changinshare=(25)) saving(change_25, replace)

combomarginsplot change_25neg change_20neg change_15neg change_10neg change_5neg change_zero change_5 change_10 change_15 change_20 change_25, ///
	recast(line) recastci(rline) ciopts(lpattern(dash)) labels("-25" "-20""-15""-10""-5""0""5""10""15""20""25") ///
	xtitle("Change in Vote Share in Centralized Parties") ylabel(15(10)65) ytitle("") ///
	note("Predicted margins calculated at Centralized Selection=1 and Centralized Selection*Vote Share=Vote Share")
	graph save change_centralized_1, replace 

graph combine change_centralized_0.gph change_centralized_1.gph		
